<?php

//Setup theme ================================================================>
function init_tpm() {
    load_theme_textdomain( 'tpmvn', get_template_directory() . '/languages' );

    // This theme uses wp_nav_menu() in top locations.
    register_nav_menus( array(
        'primary'   => __( 'Top primary menu', 'tpmtheme' ),
        //'secondary' => __( 'Secondary menu in left sidebar', 'twentyfourteen' ),
    ) );
}
add_action( 'after_setup_theme', 'init_tpm' );


//Add customize style for theme ===================>
function add_tpm_style() {

}
add_action( 'wp_enqueue_scripts', 'add_tpm_style' );

//Make title =====================================>
function tpmtheme_wp_title( $title, $sep ) {
    global $paged, $page;

    if ( is_feed() ) {
        return $title;
    }

    // Add the site name.
    $title .= get_bloginfo( 'name', 'display' );

    // Add the site description for the home/front page.
    $site_description = get_bloginfo( 'description', 'display' );
    if ( $site_description && ( is_home() || is_front_page() ) ) {
        $title = "$title $sep $site_description";
    }

    // Add a page number if necessary.
    if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
        $title = "$title $sep " . sprintf( __( 'Page %s', 'tpmtheme' ), max( $paged, $page ) );
    }

    return $title;
}
add_filter( 'wp_title', 'tpmtheme_wp_title', 10, 2 );